home *** CD-ROM | disk | FTP | other *** search
- Path: mudskipper.cac.psu.edu!user
- From: fcusack@tdx.org (frank.)
- Newsgroups: comp.lang.c
- Subject: Re: What is '?' in C mean....?????
- Date: Thu, 04 Jan 1996 11:15:54 -0500
- Organization: Penn State University, Center for Academic Computing
- Message-ID: <fcusack-0401961115540001@mudskipper.cac.psu.edu>
- References: <4cgsa8$bm2@wumpus.cc.uow.edu.au>
- NNTP-Posting-Host: mudskipper.cac.psu.edu
-
- In article <4cgsa8$bm2@wumpus.cc.uow.edu.au>, tp86@wumpus.cc.uow.edu.au
- (PAOPENG THEERADECH) wrote:
-
- > Hello to all.
- > I got something here to ask you guys. I saw some symbol like "?" be
- > used in some codes. I don't understand what does it mean. I tried to read some
- > text books but I still cannot find the detail about "?". The codes that I saw
- > are;
- > max = x>y ? x:y;
- >
- > and
- >
- > printf("%d", x>y ? x:y);
- >
- > Could anyone here explain to me what is "?" means and what the purpose
- of using
-
- You can probably find this info in the FAQ!!!!
-
- ? : is C's ternary operator. if the condition is met, perform the
- operation after the ?; if the condition is not met, perform the operation
- after the :
-
- eg: ("pseudo"code)
-
- did you read the FAQ ? pat yourself on back : read before posting
- ~Frank
-
- -- Does Santa exist? --> http://www.tdx.org/~fcusack/santa.html --
- -- PGP key fingerprint: 4D 31 4E 12 8B 3A 00 B2 61 20 56 BA 90 FA 35 3B --
-